#import "MathGameViewController.h"
#import <Foundation/NSString.h>
#import <Foundation/Foundation.h>
#import "MainMenuController.h"
#import "SpeedMath.h";
@implementation MathGameViewController

@synthesize speedMath;
@synthesize mode;
@synthesize difficultyView;
@synthesize tutorialView;
@synthesize resetGameDataButton;
@synthesize backButtonn;
@synthesize tutorialIMG;
@synthesize resetLabel;
SpeedMath *game;

//show difficulty view
-(IBAction)setDiff:(id)sender
{	resetLabel.hidden = TRUE;
	game = [[SpeedMath alloc] initWithNibName:@"SpeedMath" bundle:nil];
	self.speedMath = game;
	[game release];
	
	[self.view addSubview:difficultyView];
	[self.view bringSubviewToFront:difficultyView];
	difficultyView.hidden = FALSE;
	
	if(sound)
		[speedMath soundOn];
	else
		[speedMath soundOff];
}

-(IBAction)backnOne:(id)sender
{
	difficultyView.hidden = TRUE;
	[difficultyView removeFromSuperview];
}

-(IBAction)endSetDiff:(id)sender
{
	[self presentModalViewController:speedMath animated:YES];
}

-(IBAction)setMd1:(id)sender
{
	[speedMath setMode1];
	[self presentModalViewController:speedMath animated:YES];
}
-(IBAction)setMd2:(id)sender
{
	[speedMath setMode2];
	[self presentModalViewController:speedMath animated:YES];
}
-(IBAction)setMd3:(id)sender
{
	[speedMath setMode3];
	[self presentModalViewController:speedMath animated:YES];
}
-(IBAction)setMd4:(id)sender
{
	[speedMath setMode4];
	[self presentModalViewController:speedMath animated:YES];
}

-(IBAction)startNGame:(id)sender;
{
	[speedMath startGame:sender];
}

-(IBAction)showTutorial:(id)sender
{
	[self.view addSubview:tutorialView];
	[self.view bringSubviewToFront:tutorialView];
	tutorialView.hidden = FALSE;
}

-(IBAction)endShowTutorial:(id)sender
{
	tutorialView.hidden = TRUE;
	[tutorialView removeFromSuperview];
}

-(IBAction)tutorial1:(id)sender{
	UIImage* img = [UIImage imageNamed:@"tutorial-1.png"];
	[tutorialIMG setImage:img];
}
-(IBAction)tutorial2:(id)sender{
	UIImage* img = [UIImage imageNamed:@"tutorial-2.png"];
	[tutorialIMG setImage:img];
}
-(IBAction)tutorial3:(id)sender{
	UIImage* img = [UIImage imageNamed:@"tutorial-3.png"];
	[tutorialIMG setImage:img];
}


-(IBAction)showResetGameDataButton:(id)sender
{
	
}
-(void)showResetLabel
{
	self.resetLabel.hidden = FALSE;
}
//toggles sound on and off
- (IBAction)soundToggle:(id)sender{
	if(sound)
		sound=FALSE;
	else
		sound=TRUE;
}


- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
	// Return YES for supported orientations
	return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

- (void)dealloc {
	[super dealloc];
}


- (void)didReceiveMemoryWarning {
	[super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
	// Release anything that's not essential, such as cached data
}

@end